using System;
#pragma warning disable 3009
#pragma warning disable 3002
#pragma warning disable 3001
namespace TSharp.Core.Util.TypeConvert
{
    /// <summary>
    /// 
    /// </summary>
    /// <author>
    /// tangjingbo
    /// </author>
    /// <remarks>
    /// tangj15 at 2012-4-27 9:53
    /// </remarks>
    public class NullableUInt32TypeDetectorImpl : NullableValueTypeDetector<uint>
    {
        /// <summary>
        /// Strings the specified detector obj.
        /// </summary>
        /// <param name="detectorObj">The detector obj.</param>
        /// <param name="arg">The arg.</param>
        /// <returns></returns>
        public override uint? String(string detectorObj, uint? arg)
        {
            uint result;
            bool parseSucceed = uint.TryParse(detectorObj, out result);
            return parseSucceed ? result : arg;
        }

        /// <summary>
        /// Us the int32.
        /// </summary>
        /// <param name="detectorObj">The detector obj.</param>
        /// <param name="arg">The arg.</param>
        /// <returns></returns>
        public override UInt32? UInt32(UInt32 detectorObj, UInt32? arg)
        {
            return detectorObj;
        }
    }
}